package com.yifan.planMode.observer;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author YIFan
 * @Date 2020/12/3 17:24
 * @Version 1.0
 */
public class QianGe2 implements Subjects {
    private String name = "强哥二号";
    private List<Observer> list = new ArrayList<>();

    @Override
    public void addObserver(Observer observer) {
        list.add(observer);
    }

    @Override
    public void removeObserver(Observer observer) {
        list.remove(observer);
    }

    @Override
    public void notifyObserver(String msg) {
        for (Observer obs : list) {
            obs.update(name+"："+msg);
        }
    }
}
